import { create } from "zustand";
import { persist, createJSONStorage } from "zustand/middleware";
interface ThemeStore {
  currentTheme: "dark" | "light";
  setCurrentTheme: (currentTheme: "dark" | "light") => void;
}

const useThemeStore = create<ThemeStore>()(
  persist(
    (set) => ({
      currentTheme: "light",
      setCurrentTheme: (currentTheme) => set({ currentTheme }),
    }),
    {
      name: "THEME_STORAGE",
      storage: createJSONStorage(() => localStorage),
    }
  )
);

export default useThemeStore;
